<!--
 * @Description:告警码和位置的列表
 * @Author: 0001101008/HuYuxi
 * @Date: 2021-09-06 15:11:20
 * @LastEditTime: 2021-09-16 11:12:37
 * @LastEditors: 0001101008/HuYuxi
-->
<template>
  <div class="port-box">
    <el-form-item label-width="100px">
      <tao-table class="table-box" :data="dataList" ref="table">
        <el-table-column align="center" label="告警码" prop="id" width="120" />
        <!-- 名称 -->
        <el-table-column align="left" label="名称" prop="label">
          <template slot-scope="scope">{{ scope.row.label }}</template>
        </el-table-column>
        <!-- 操作 -->
        <el-table-column fixed="right" label="操作" align="center" width="80px">
          <!-- 编辑  删除-->
          <template slot-scope="scope">
            <el-button
              type="text"
              style="color: #FA6962"
              icon="el-icon-delete"
              @click="deleteCode(scope.$index)"
            >删除</el-button>
          </template>
        </el-table-column>
      </tao-table>
    </el-form-item>
  </div>
</template>
<script>
export default {
  props: ['dataList'],
  data () {
    return {
      labelWidth: '100px'
    };
  },
  computed: {},
  mounted () { },
  methods: {
    deleteCode (index) {
      this.dataList.splice(index, 1);
      let flag = this.dataList.length === 0 ? false : true;
      this.$emit('getCodeInfo', flag);
    }
  }
};
</script>
<style lang="scss" scoped>
.port-box {
  .table-box {
    height: 200px;
    ::v-deep .el-button {
      padding: 0;
    }
  }
}
</style>